Skip to content

Conversation

@mpociot
Copy link
Contributor

@mpociot mpociot commented Jan 12, 2017

This PR allows you to use a callback function with model to control the required state of a form field.

Example to make a field only required, if another field is empty:

{
    type: "text",
    label: "Phone mobile",
    model: "phone_mobile",
    required: function(model) {
    	return (model.phone_home === null);
    }
}

just like it's already possible with "visible" and "disabled"
@icebob icebob merged commit 17caa43 into vue-generators:master Jan 13, 2017
@icebob
Copy link
Member

icebob commented Jan 13, 2017

Good job! Thanks!

@mpociot
Copy link
Contributor Author

mpociot commented Jan 16, 2017

What do you think of having the ability to use callback functions for the other boolean checks as well? I would provide a callback for this too.

@icebob
Copy link
Member

icebob commented Jan 16, 2017

Please tell which properties do you think?

@mpociot
Copy link
Contributor Author

mpociot commented Jan 16, 2017

I was thinking of readonly and featured. Then all Boolean properties have the same behavior.

@icebob
Copy link
Member

icebob commented Jan 16, 2017

Ok, good idea.

@icebob
Copy link
Member

icebob commented Jan 21, 2017

@mpociot could you make a new PR with readonly and featured?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants